get-the-solution

Discrete cosine transform

By
on Regards: education; Article; python; sip;

This text is from the category SIP (Signal and image processing). Previous text hilbert transform

Beside the discrete fourier transformation, which disassembles the signal in periodic sin waves, there exists other types of transformations like the

which can be used to analyze the spectrum of a signal.

The discrete cosine transform is similar to the fourier transformation as it computes the spectrum of a signal.

One difference between the fourier- and the discrete cosine transformation (DCT) is the base function for the frequency. The fourier transformation uses eix and the cosine transformation uses cosines as base function. The cosine base function has the advantage that it has a diffrent typ of periodicity.

Analysis (from time to frequency):

$X[k]=2\cdot\sum^{N-1}_{n=0}x[n]\cdot(\frac{\pi}{2N}\cdot k\cdot(2n+1))\qquad(0\le k<N-1)$

The number two in front of the sum is just a normalization factor

Synthesis (from frequency to time)

$x[n]=sum^{N-1}_{n=0}X'[k]\cdot(\frac{\pi}{2N}\cdot k\cdot(2n+1))\qquad(0\le n<N-1)$

1/N in front of the sum is used as normalization facto

$X'[k]=\begin{cases} X[0]/2; k=0 \\ X[k]; otherwise\\ \end{cases}$ this ensures that the DCT is an invertible transform

Remarks: - In the DCT synthesis the bases function is the same as in the DCT analysis function. In the fourier transformation the base function would differ (complex conjugate is used) - The DCT is an invertible transformation, which means its theoreticly not lossless - There are various variants of the DCT: I-IV (the one above is the DCT II) - When using the DCT we assume that outside the specified range the signal is repeated periodically.

DFT vs DCT

When applying the base function of DFT and the DCT to a signal we can observ some interessting differences:

DFT - any signal applied with dft will be periodic because the base function are periodic

DCT - applying the DCT is not periodic but symmetric

As images represent signals which are not periodic the DCT is very suitable for transforming images. As the DCT can compact most information to low frequency componentens will result in less memory space to be required for the image. On the other hand high frequency components are not that good preserved and will result in blured artifacts.

DCT is similar to the Fast Fourier Transform (FFT), but can approximate lines well with fewer coefficients [see The Discrete Cosine Transform (DCT), 2021,06.27, https://users.cs.cf.ac.uk/Dave.Marshall/Multimedia/node231.html]

The DCT extends / repeats signals symmetrically, while the DFT extends signals periodically

Continue to Discrete Wavelet transformation

Sources: